<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>微信电脑网站支付</title>
    <script src="statics/jquery-1.12.4.min.js"></script>
    <script src="statics/qrcode.js"></script>
    <script>
        //D10000012017063016272052c307
        //D100000120170630135335607e40
        //D100000120170630135335607e40
        //D100000120170630145732c2ce35
        //D1000001201706301520489ea60e
        $(function(){
            $("#fk").click(function () {
                var orderno= new Date().getTime();
                $.ajax({
                    type:"get",
                    url:"/trade/api/wxpay/createqccode/D100000120170630152639b3268a",
                    dataType:"json",
                    success:function (msg) {
                        alert(msg.data.code_url);
                        if(msg.data.code_url){
                            new QRCode($("#erweima")[0], msg.data.code_url);  // 设置要生成二维码的链接
                            //10  发送请求判断 是否成功
                        }
                    }
                });
                var fs= setInterval(function () {
                    $.ajax({
                        type:"get",
                        url:"/trade/api/wxpay/queryorderstatus/D100000120170630152639b3268a",
                        dataType:"json",
                        success:function (msg) {
                            // alert(msg);
                            console.info(msg);
                            if(msg.data.trade_state!="NOTPAY"){
                                alert(" it is success ,i am jump");
                                fs.clearInterval();
                                // /window.location.href="result.jsp";
                            }else{
                                alert("mei you fu kuan ,ji xu fa song qingqiu");
                            }
                        }
                    });
                },10000);
            });


        });

    </script>
</head>
<body>
<h2>Hello World!</h2>

<input id="fk" type="button" value="付款">
this is trade  mok
<hr/>
<div id="erweima" ></div>
<a href="">查看订单状态</a>

</body>
</html>
